/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package frc.circuitrunners;

import edu.wpi.first.wpilibj.AnalogModule;
import edu.wpi.first.wpilibj.Dashboard;
import edu.wpi.first.wpilibj.DigitalModule;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Solenoid;

/**
 *
 * @author James
 */
public class DashboardHandler{
    public static double FR = 0, FL = 0, BR = 0, BL = 0;
    public static boolean aimed = false;
    public static double aimOffset = 0.0;
    public static int target = 0;
    public static double shooterSpeed = 0.0;
    public static double conveyorSpeed = 0.0;
    public static int robotState = 0;
    private static long timeSinceCommit = System.currentTimeMillis();
    public static void updateDashboard() {
        if((System.currentTimeMillis() - timeSinceCommit) >= 500){
            timeSinceCommit = System.currentTimeMillis();
            Dashboard lowDashData = DriverStation.getInstance().getDashboardPackerLow();
            lowDashData.addCluster();{
                lowDashData.addCluster();{
                    lowDashData.addDouble(FR);
                    lowDashData.addDouble(FL);
                    lowDashData.addDouble(BR);
                    lowDashData.addDouble(FL);
                    lowDashData.addDouble(shooterSpeed);
                    lowDashData.addDouble(conveyorSpeed);
                    lowDashData.addInt(target);
                    lowDashData.addDouble(aimOffset);
                    lowDashData.addBoolean(aimed);
                }
                lowDashData.finalizeCluster();
                lowDashData.addInt(robotState);
            }
            lowDashData.finalizeCluster();
            lowDashData.commit();
        }
    }
}
